<template>
  <div class="body">
    <!-- 标题 -->
    <v-head></v-head>
    <!-- 新闻列表 -->
    <Row class="restand">
    <i-col class="standkepudigndan" span="17">
      <div class="standardt">
        新闻列表
      </div>
      <div class="result">
        <Row class="orderrow" v-for="(item,index) in results" :key="index">
          <i-col span="1">
            <div class="orderimg" alt=""></div>
          </i-col>
          <i-col span="20">
            <span @click="getDetail(item.id)" class="itemtitle">{{item.title}}</span>
          </i-col>
          <i-col span="2">
            <div  class="itemtitledate">{{item.createDate.substring(0,10)}}</div>
          </i-col>
        </Row>
        <Page :total="dataCount" :page-size="pageSize" show-total @on-change="changepage" v-if="showPage" class-name="changepage" show-elevator />
      </div>
    </i-col>
    </Row>
    <!-- 底部 -->
    <v-foot></v-foot>
    <Back-top></Back-top>
  </div>
</template>
<script>
import {neturl} from '../assets/js/common'
export default {
  name: 'seniorsearch',
  data () {
    return {
      keyword: '',
      dataCount: 0,
      pageSize: 15,
      pageNum: 1,
      showPage: false,
      results: []
    }
  },
  methods: {
    // 获取新闻列表
    getNewlist () {
      let uploadcc = { data: '{page: ' + this.pageNum + ', pagesize: ' + this.pageSize + ', cateid:"8a81a04751467b80015146ad2b670011"}' }
      this.$axios.post(neturl + '/by/news/getlist', uploadcc
      ).then(res => {
        // console.log(res)
        this.results = res.data.data.result
        this.dataCount = res.data.data.records
        this.showPage = true
        this.$Spin.hide()
      })
    },
    logout () {
      this.$cookie.delete('user')
      let routeUrl = this.$router.resolve({
        path: '/'
      })
      window.open(routeUrl.href)
    },
    changepage (value) {
      this.pageNum = value
      this.getNewlist()
    },
    getDetail (id) {
      let routeData = this.$router.resolve({path: '/newitem', query: {id: id}})
      window.open(routeData.href, '_blank')
    }
  },
  created () {
    this.$Spin.show()
    // this.model1 = this.cityList[0].value
    this.userinfo = this.$cookie.get('user')
    this.userinfo = JSON.parse(this.userinfo)
    // 已登录
    if (this.userinfo != null) {
      this.islogin = true
      this.islog = false
      this.username = this.userinfo.realName
    }
    this.getNewlist()
  }
}
</script>

<style scoped>
  @import '../assets/css/newlist.css';
</style>
